package com.cqc.googleplay.fragment;

import java.util.ArrayList;
import java.util.List;

import com.cqc.googleplay.R;
import com.cqc.googleplay.adapter.HomeFragmentAdapter;
import com.cqc.googleplay.utils.CommonUtil;
import com.cqc.googleplay.view.PagerSlidingTab;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class HomeFragment extends Fragment {

	private View rootView;
	private PagerSlidingTab indicatorTab;
	private ViewPager viewPager;
	private HomeFragmentAdapter adapter;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
		rootView = inflater.inflate(R.layout.fragment_home, container, false);
		indicatorTab = (PagerSlidingTab) rootView.findViewById(R.id.indicatorTab_frag_home);
		viewPager = (ViewPager) rootView.findViewById(R.id.viewPager_frag_home);
//		viewPager.setOffscreenPageLimit(CommonUtil.getStringArray(R.array.tab_names).length-1);
		adapter = new HomeFragmentAdapter(getActivity().getSupportFragmentManager());
		viewPager.setAdapter(adapter);
		indicatorTab.setViewPager(viewPager);
		return rootView;
	}
}
